import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
    //用于存放配置路由信息的文件夹
    {
        path: '/',
        component: HomeView,
        children: [
            {
                path: '/sys-admin/product/album/add-new',
                component: () => import('../views/sys-admin/product/AlbumAddNewView.vue')
            },
            {
                path: '/sys-admin/product/album',
                component: () => import('../views/sys-admin/product/AlbumListView.vue')
            },
            {
                path: '/sys-admin/product/attributeTemplate/add-new',
                    component: () => import('../views/sys-admin/product/AttributeTemplateAddNewView.vue')
            },
            {
                path: '/sys-admin/product/attributeTemplate',
                component: () => import('../views/sys-admin/product/AttributeTemplateListView.vue')
            },
            {
                path: '/sys-admin/product/attribute/add-new',
                component: () => import('../views/sys-admin/product/AttributeAddNewView.vue')
            },
            {
                path: '/sys-admin/product/attribute',
                component: () => import('../views/sys-admin/product/AttributeListView.vue')
            },
            {
                path: '/sys-admin/product/category',
                component: () => import('../views/sys-admin/product/CategoryListView.vue')
            }
            ,
            {
                path: '/sys-admin/product/category/add-new',
                component: () => import('../views/sys-admin/product/CategoryAddNewView')
            },
            {
                path: '/sys-admin/product/brand',
                component: () => import('../views/sys-admin/product/BrandListView.vue')
            }
            ,
            {
                path: '/sys-admin/product/brand/add-new',
                component: () => import('../views/sys-admin/product/BrandAddNewView')
            },
            // ======================== 权限管理 ========================
            {
                path: '/sys-admin/permission/admin/add-new',
                component: () => import('../views/sys-admin/permission/AdminAddNewView')
            },
            {
                path: '/sys-admin/permission/admin',
                component: () => import('../views/sys-admin/permission/AdminListView')
            },
        ]
    },
    {
        path: '/test',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ '../views/TestView.vue')
    },
    {
        path: '/login',
        component: () => import('../views/LoginView.vue')
    }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
